:root {
  /* 颜色变量 */
  --bg-color: #121212;
  --primary-color: #bb86fc;
  --secondary-color: #03dac6;
  --text-color: #e1e1e1;
  --card-bg: #1e1e1e;
  --hover-color: #3600b300;
  --footer-bg: #000000;
}

/* 全局样式 */
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 10px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* 移动端滚动优化 */
@media (pointer: coarse) {
  ::-webkit-scrollbar {
    width: 6px;
  }

  body {
    -webkit-overflow-scrolling: touch;
  }

  .main-container {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* 主要内容容器 */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px; /* 为页脚留出空间 */
}

/* 内容容器样式 */
.iframe-container {
  flex: 1;
  min-height: 300px;
  margin: 1rem 0;
  position: relative;
}

/* 加载状态 */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  text-align: center;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(3, 218, 198, 0.1);
  border-top: 4px solid var(--secondary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: var(--secondary-color);
  font-size: 1.2rem;
}

/* 错误提示 */
.error-message {
  text-align: center;
  padding: 1.5rem;
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
  border-radius: 8px;
  margin: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-left: 4px solid #ff6b6b;
}

.error-icon {
  font-size: 2rem;
}

.error-link {
  color: var(--primary-color);
  text-decoration: none;
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.error-link:hover {
  background-color: var(--primary-color);
  color: white;
}

/* 头部样式 */
header {
  text-align: center;
  padding: 0rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

header strong {
  font-size: 2rem;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  margin: 0rem;
}

#mainlink {
  color: var(--secondary-color);
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.3s ease;
  display: inline-block;
  padding: 0rem;
  border-radius: 4px;
}

#mainlink:hover {
  background-color: var(--hover-color);
  transform: translateY(-2px);
}

/* 主要内容区域 */
.main-content {
  flex: 1;
  padding: 1.5rem 0;
}

.wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 分类区块样式 */
.demo{
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 1.2rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.flag {
  font-size: 1.4rem;
  color: var(--primary-color);
  padding: 0.5rem 0 0.5rem 1.8rem;
  border-bottom: 1px solid rgba(187, 134, 252, 0.2);
  grid-column: span 3;
  position: relative;
}

.flag::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.8rem;
  height: 0.8rem;
  background-color: var(--secondary-color);
  border-radius: 50%;
}

.bar {
  padding: 0.8rem;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.bar:hover {
  box-shadow: 0 4px 8px rgba(187, 134, 252, 0.065);
}

.bar:active {
  transform: scale(0.98);
}

.bar a {
  color: var(--text-color);
  text-decoration: none;
  display: block;
  position: relative;
  cursor: default;
}

.bar a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: var(--secondary-color);
  transition: width 0.3s ease;
}

.bar:hover a::after {
  width: 100%;
}

.bar a strong {
  color: var(--secondary-color);
}

.bar:hover {
  background-color: rgba(255, 255, 255, 0.065);
  transform: scale(1.02);
}

/* iframe样式 */
.iframe-container {
  width: 100%;
  margin: 1.5rem 0;
  flex: 1;
  min-height: 300px;
  position: relative;
  overflow: visible;
}

iframe {
  width: 100%;
  border: none;
  background-color: var(--bg-color);
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  min-height: 300px;
  height: auto;
  overflow-y: visible;
}

/* 确保页脚可见 */
footer {
  position: relative;
  z-index: 1;
}

iframe.loading {
  opacity: 0;
  height: 100px !important;
}

/* 确保iframe内容完全展开 */
.iframe-container {
  overflow: auto;
}

/* 页脚样式 */
footer {
  background-color: var(--footer-bg);
  padding: 0rem;
  text-align: center;
}

/* 骨架屏效果 */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  margin-bottom: 0;
  width: 80%;
}

.skeleton-image {
  height: 150px;
  margin-bottom: 1rem;
  border-radius: 8px;
}

.skeleton-card {
  padding: 1rem;
  background-color: var(--card-bg);
  border-radius: 8px;
  margin-bottom: 1rem;
}

@media screen and (width<768px) {
  .wrapper {
    padding: 0;
    margin: 10px;
  }
  .demo {
    grid-template-columns: 1fr; /* 改为单列布局 */
  }

  .flag {
    grid-column: span 1; /* 调整标志的跨列 */
  }
  .flex {
    /* display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem; */
  }
  .bar {
  }
}
